import { ref } from 'vue'
import { defineStore } from 'pinia'
import { getWallListAPI } from '@/api/wall'

// 基础信息
export const useCommonStore = defineStore(
  'common',
  () => {
    // 是否折叠侧边栏
    const isCollapse = ref(false)
    // 设置折叠
    const setCollapse = () => {
      isCollapse.value = !isCollapse.value
    }

    // 墙列表
    const wallList = ref([])
    const getWallList = async () => {
      wallList.value = await getWallListAPI()
    }

    return { isCollapse, setCollapse, wallList, getWallList }
  },
  {
    persist: {
      storage: sessionStorage
    }
  }
)
